package com.xquant.system.api.factory;

import com.xquant.common.core.web.domain.AjaxResult;
import com.xquant.common.core.web.page.TableDataInfo;
import com.xquant.system.api.domain.SysOperLog;
import com.xquant.system.api.domain.TsysInterfaceLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
import com.xquant.common.core.domain.R;
import com.xquant.system.api.RemoteLogService;
import com.xquant.system.api.domain.SysLogininfor;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 日志服务降级处理
 *
 * @author xquant
 */
@Component
public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class);

    @Override
    public RemoteLogService create(Throwable throwable)
    {
        log.error("日志服务调用失败:{}", throwable.getMessage());
        return new RemoteLogService()
        {
            @Override
            public R<Boolean> saveLog(SysOperLog sysOperLog, String source)
            {
                return null;
            }

            @Override
            public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source)
            {
                return null;
            }

            @Override
            public R<Boolean> saveImportLog(TsysInterfaceLog interfaceLog) {
                return null;
            }

            @Override
            public R<Boolean> getInfoByICode(String id) {
                return null;
            }

            @Override
            public R<Boolean> remove(String[] ids) {
                return null;
            }

            @Override
            public TableDataInfo queryLog(TsysInterfaceLog tsysInterfaceLog) {
                TableDataInfo tableDataInfo = new TableDataInfo();
                tableDataInfo.setCode(500);
                tableDataInfo.setMsg("调用失败");
                return tableDataInfo;
            }

        };

    }
}
